/*
 *Callback encargado de procesar las respuestas del servidor. Integra los dato recibidos por el servidor y los widgets de la UI.
 *
 *  Created on: Jun 7, 2011
 *      Author: jirka
 */

#ifndef SCREENCASTING_TEACHING_SYSTEM___CLIENT___SERVER_CALLBACK_HANDLER_GUI_IMPL_H_
#define SCREENCASTING_TEACHING_SYSTEM___CLIENT___SERVER_CALLBACK_HANDLER_GUI_IMPL_H_

#include "servercallbackhandler.h"
#include <log4cxx/logger.h>
#include <vector>
class ScreencastingWindow;
class LoginDialog;
class MainWindow;
class VideoPlayerWindow2;

/**
 *
 */
class ServerCallbackHandlerGuiImpl: public ServerCallbackHandler {
public:
	static ServerCallbackHandlerGuiImpl& getInstance(); // singleton
	virtual ~ServerCallbackHandlerGuiImpl() {}
	virtual void handleLoginRequest(User* user);
	virtual void handleStartScreencast(Lesson* lesson);
	virtual void handleStopScreencast(Lesson* lesson);
	virtual void handleFindShowsRequest(std::list<Course*> * courses, std::list<Lesson*> * lessons);
	virtual void handleScreencastData(std::vector<char> data,int pts);
	virtual void handleChatMessage(ChatMessage* msg);
	void setMainWindow(MainWindow *mainWindow) { mainWindow_ = mainWindow; }
	void setLoginDialog(LoginDialog *loginDialog) { loginDialog_ = loginDialog; }
	void setScreencastingWindow(ScreencastingWindow *screencastingWindow) { screencastingWindow_ = screencastingWindow; }
	virtual void handleScreencastAudioData(std::vector<char> data,int pts);
	virtual void handleScreencastNotAvailable(Lesson* lesson);
private:
	log4cxx::LoggerPtr logger_;

	ServerCallbackHandlerGuiImpl(); // singleton
	ServerCallbackHandlerGuiImpl(ServerCallbackHandlerGuiImpl const&); // singleton
	void operator=(ServerCallbackHandlerGuiImpl const&); // singleton

	// widget pointers
	MainWindow *mainWindow_;
	LoginDialog *loginDialog_;
	ScreencastingWindow *screencastingWindow_;
};

#endif /* SCREENCASTING_TEACHING_SYSTEM___CLIENT___SERVER_CALLBACK_HANDLER_GUI_IMPL_H_ */
